package ar.edu.utn.frsf.proyectofinal.sistemadecontrolmodbus.persistence.model;

import java.util.List;

import javax.persistence.CascadeType;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.FetchType;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.OneToMany;
import javax.persistence.SequenceGenerator;
import javax.persistence.Table;

import org.hibernate.annotations.Cascade;

@Entity
@Table(name="DEVICE_TYPE")
public class DeviceType {

	@Id
	@Column(name="id")
	@SequenceGenerator(name = "SecuenciaTipoDispositivo", sequenceName = "seq_dev_type", allocationSize = 1)
	@GeneratedValue(strategy = GenerationType.SEQUENCE, generator = "SecuenciaTipoDispositivo")
	private Integer ID;
	
	@Column(name="name")
	private String name;
	
	@OneToMany(cascade = CascadeType.ALL,mappedBy="deviceType",orphanRemoval=true)
	private List<Field> fields;
	
	@OneToMany(cascade = CascadeType.ALL,mappedBy="deviceType",orphanRemoval=true)
	private List<Alarm> alarms;
	
	@OneToMany(cascade = CascadeType.ALL,mappedBy="deviceType",orphanRemoval=true)
	private List<CompoundCommand> compoundCommands;
	
	@OneToMany(cascade = CascadeType.ALL,mappedBy="deviceType",orphanRemoval=true)
	private List<SimpleCommand> simpleCommands;
	
	@OneToMany(cascade = CascadeType.ALL,mappedBy="deviceType",fetch = FetchType.EAGER,orphanRemoval=true)
	private List<SoundRequest> soundRequests;
	
	/**
	 * @return the iD
	 */
	public Integer getID() {
		return ID;
	}
	/**
	 * @param iD the iD to set
	 */
	public void setID(Integer iD) {
		ID = iD;
	}
	/**
	 * @return the name
	 */
	public String getName() {
		return name;
	}
	/**
	 * @param name the name to set
	 */
	public void setName(String name) {
		this.name = name;
	}
	/**
	 * @return the fields
	 */
	public List<Field> getFields() {
		return fields;
	}
	/**
	 * @param fields the fields to set
	 */
	public void setFields(List<Field> fields) {
		this.fields = fields;
	}
	/**
	 * @return the alarms
	 */
	public List<Alarm> getAlarms() {
		return alarms;
	}
	/**
	 * @param alarms the alarms to set
	 */
	public void setAlarms(List<Alarm> alarms) {
		this.alarms = alarms;
	}
	/**
	 * @return the compoundCommands
	 */
	public List<CompoundCommand> getCompoundCommands() {
		return compoundCommands;
	}
	/**
	 * @param compoundCommands the compoundCommands to set
	 */
	public void setCompoundCommands(List<CompoundCommand> compoundCommands) {
		this.compoundCommands = compoundCommands;
	}
	/**
	 * @return the simpleCommands
	 */
	public List<SimpleCommand> getSimpleCommands() {
		return simpleCommands;
	}
	/**
	 * @param simpleCommands the simpleCommands to set
	 */
	public void setSimpleCommands(List<SimpleCommand> simpleCommands) {
		this.simpleCommands = simpleCommands;
	}
	/**
	 * @return the soundRequests
	 */
	public List<SoundRequest> getSoundRequests() {
		return soundRequests;
	}
	/**
	 * @param soundRequests the soundRequests to set
	 */
	public void setSoundRequests(List<SoundRequest> soundRequests) {
		this.soundRequests = soundRequests;
	}

	
	
}
